#include <iostream>
#include <unordered_set>
#include <algorithm>
#include <vector>
using namespace std;


int main()
{
	string s;
	cin >> s;
	unordered_set<char> usechar;
	for (auto ele : s)
	{
		usechar.insert(ele);
	}
	if (usechar.size() == 1)
	{
		cout << -1 << endl;
		return 0;
	}

	vector<char> d_chars(usechar.begin(), usechar.end());
	int n = d_chars.size();
	sort(d_chars.begin(), d_chars.end());

	for (int i = 0; i < s.size(); i++)
	{
		char c = s[i];
		auto it = lower_bound(d_chars.begin(), d_chars.end(), c);
		if (it == d_chars.end() - 1)
			it = d_chars.begin();
		else
			it = it + 1;
		cout << *it;

	}

	return 0;
}